package 第一章基础算法.位运算.id801二进制中1的个数;

import java.util.Scanner;

public class Main {
    public static void main(String[]args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for(int i = 0;i<n;i++){
            nums[i] = scanner.nextInt();
            int res = 0;
            for(int j = 31;j>=0;j--){
                int cur = (nums[i] >> j) & 1;
                if(cur == 1)res++;
            }
            System.out.print(res+" ");
        }
    }
}